<?php


namespace app\model;


use think\Model;

class Admin extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'admin';

    public static function executeData(array $param)
    {
        $obj = new Admin;
        if(empty($param['password'])){
            unset($param['password']);
        }else{
            $param['password'] = md5($param['password']);
        }
        if(empty($param['id'])){
            $param['ctime'] = date("Y-m-d H:i:s",time());
            $res = $obj->save($param);
        }else{
            $res = $obj->save($param,['id' => $param['id']]);
        }
        return $res;
    }
}